
using System;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Entity;

namespace Data
{
	public class DAActPerParticipantes
	{

        public static DataTable ListarParticipantes(int intId_PerActFec)
        {
            SqlDatabase sqlParticipantes = new SqlDatabase(Configuracion.GetConnection);
            DbCommand dbCmd = sqlParticipantes.GetStoredProcCommand("plst_Participantes");
            sqlParticipantes.AddInParameter(dbCmd, "@intId_PerActFec", DbType.Int16, intId_PerActFec);
            return sqlParticipantes.ExecuteDataSet(dbCmd).Tables[0];
        }
        
        public static DataTable ObtenerPlanAuditoria(String Nro_PlanAuditoria)
		{
			SqlDatabase sqlClient = new SqlDatabase(Configuracion.GetConnection);
			DbCommand dbCmd = sqlClient.GetStoredProcCommand("sp_ObtenerPlanAuditoria");
	      
	        sqlClient.AddInParameter(dbCmd, "@Nro_PlanAuditoria", DbType.String, Nro_PlanAuditoria);
	       

	        return sqlClient.ExecuteDataSet(dbCmd).Tables[0];
		}

        //public static void RegistrarPlanAuditoria(BEPeriodo oBEPlanAuditoria)
        //{
        //    SqlDatabase sqlClient = new SqlDatabase(Configuracion.GetConnection);

        //    using (DbConnection connection = sqlClient.CreateConnection())
        //    {
        //        connection.Open();
        //        DbTransaction transaction = connection.BeginTransaction();
        //        try
        //        {
        //            DbCommand dbCmd = sqlClient.GetStoredProcCommand("sp_InsertPlanAuditoria");

        //            sqlClient.AddInParameter(dbCmd, "@Id_PlanAuditoria", DbType.String, oBEPlanAuditoria.Id_PlanAuditoria);
        //            sqlClient.AddInParameter(dbCmd, "@Nom_Plan", DbType.String, oBEPlanAuditoria.Nom_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@Des_Plan", DbType.String, oBEPlanAuditoria.Des_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@FecIni_Plan", DbType.Date, oBEPlanAuditoria.FecIni_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@FecFin_Plan", DbType.Date, oBEPlanAuditoria.FecFin_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@Alc_Plan", DbType.String, oBEPlanAuditoria.Alc_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@Respon_Plan", DbType.String, oBEPlanAuditoria.Respon_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@Est_Plan", DbType.Int32, oBEPlanAuditoria.Est_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@UsuCre_Plan", DbType.String, oBEPlanAuditoria.UsuCre_Plan);
        //            sqlClient.AddInParameter(dbCmd, "@UsuMod_Plan", DbType.String, oBEPlanAuditoria.UsuMod_Plan);
        //            sqlClient.ExecuteNonQuery(dbCmd);
        //            transaction.Commit();
        //        }
        //        catch (Exception ex)
        //        {
        //            transaction.Rollback();
        //            throw new Exception(ex.Message);
        //        }
        //    }
        //}

	}
}
      